"use strict";
function getPerson() {
    return {
        teach: function () { console.log('teach'); },
        study: function () { console.log('study'); }
    };
}
var person = getPerson();
// ;(<Teacher>person).teach()
// ;(<Student>person).study()
function isTeacher(person) {
    return person.teach !== undefined;
} //  person is Teacher就是类型保护语句，必须是主谓宾结构
if (isTeacher(person)) {
    person.teach();
}
else {
    person.study();
}
